package com.device.entity;

import com.device.dto.SubDeviceDTO;

import javax.persistence.*;
import java.util.List;
import java.util.UUID;

/**
 * 主设备信息
 */
@Entity
@Table(name = "config_devices")
public class Device{
    
    @Id
    @Column(name = "id")
    private UUID id;

    @Column(name = "email", nullable = false)
    private String email;
    
    @Column(name = "device_model", nullable = false)
    private String deviceModel;

    @Column(name = "device_imei", nullable = false, unique = true)
    private String deviceImei;
    
    @Column(name = "device_token", nullable = false)
    private String deviceToken;
    
    @Column(name = "device_remark")
    private String deviceRemark;
    
    @Column(name = "created_time")
    private Long createdTime;
    
    @Column(name = "updated_time")
    private Long updatedTime;

    // Constructors
    public Device() {}
    
    public Device(String deviceModel, String deviceImei, String deviceToken, String deviceRemark) {
        this.id = UUID.randomUUID();
        this.deviceModel = deviceModel;
        this.deviceImei = deviceImei;
        this.deviceToken = deviceToken;
        this.deviceRemark = deviceRemark;
        this.createdTime = System.currentTimeMillis();
        this.updatedTime = System.currentTimeMillis();
    }

    // Getters and Setters
    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }

    public String getDeviceModel() {
        return deviceModel;
    }
    
    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }
    
    public String getDeviceImei() {
        return deviceImei;
    }
    
    public void setDeviceImei(String deviceImei) {
        this.deviceImei = deviceImei;
    }
    
    public String getDeviceToken() {
        return deviceToken;
    }
    
    public void setDeviceToken(String deviceToken) {
        this.deviceToken = deviceToken;
    }
    
    public String getDeviceRemark() {
        return deviceRemark;
    }
    
    public void setDeviceRemark(String deviceRemark) {
        this.deviceRemark = deviceRemark;
    }
    
    public Long getCreatedTime() {
        return createdTime;
    }
    
    public void setCreatedTime(Long createdTime) {
        this.createdTime = createdTime;
    }
    
    public Long getUpdatedTime() {
        return updatedTime;
    }
    
    public void setUpdatedTime(Long updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "Device{" +
                "id=" + id +
                ", deviceModel='" + deviceModel + '\'' +
                ", deviceImei='" + deviceImei + '\'' +
                ", deviceToken='" + deviceToken + '\'' +
                ", deviceRemark='" + deviceRemark + '\'' +
                ", createdTime=" + createdTime +
                ", updatedTime=" + updatedTime +
                '}';
    }
        

} 